local guyong = fk.CreateSkill {
  name = "lingling__guyong",
}

Fk:loadTranslationTable{
  ["lingling__guyong"] = "鼓勇",
  [":lingling__guyong"] = "第一轮开始时，你可以成为二号位。当你与其距离为1以内的角色成为【杀】的目标后，你可以摸一张牌，"..
  "然后若你手牌多于其，你交给其一张牌，若为装备牌，其可以使用之。",

  ["#lingling__guyong-seat"] = "鼓勇：是否移至二号位？",
  ["#lingling__guyong-self"] = "鼓勇：你可以摸一张牌",
  ["#lingling__guyong-invoke"] = "鼓勇：你可以摸一张牌，然后交给 %dest 一张牌",
  ["#lingling__guyong-give"] = "鼓勇：交给 %dest 一张牌，若为装备牌其可以使用",
  ["#lingling__guyong-use"] = "鼓勇：你可以使用%arg",
}

guyong:addEffect(fk.RoundStart, {
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(guyong.name) and
      player.room:getBanner("RoundCount") == 1 and player.seat ~= 2
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askToSkillInvoke(player, {
      skill_name = guyong.name,
      prompt = "#lingling__guyong-seat",
    })
  end,
  on_use = function (self, event, target, player, data)
    player.room:moveSeatTo(player, 2, false)
  end,
})

guyong:addEffect(fk.TargetConfirmed, {
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(guyong.name) and
      data.card.trueName == "slash" and player:distanceTo(target) <= 1
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    if target == player then
      return room:askToSkillInvoke(player, {
        skill_name = guyong.name,
        prompt = "#lingling__guyong-self",
      })
    elseif room:askToSkillInvoke(player, {
      skill_name = guyong.name,
      prompt = "#lingling__guyong-invoke::"..target.id,
    }) then
      event:setCostData(self, {tos = {target}})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:drawCards(1, guyong.name)
    if target == player or player:getHandcardNum() <= target:getHandcardNum() or player.dead or target.dead then return end
    local card = room:askToCards(player, {
      skill_name = guyong.name,
      min_num = 1,
      max_num = 1,
      prompt = "#lingling__guyong-give::"..target.id,
      include_equip = true,
      cancelable = false,
    })[1]
    room:moveCardTo(card, Card.PlayerHand, target, fk.ReasonGive, guyong.name, nil, true, player)
    if not table.contains(target:getCardIds("h"), card) or target.dead then return end
    if Fk:getCardById(card).type == Card.TypeEquip then
      room:askToUseRealCard(target, {
        pattern = {card},
        skill_name = guyong.name,
        prompt = "#lingling__guyong-use:::"..Fk:getCardById(card):toLogString(),
      })
    end
  end,
})

return guyong
